import { BasicTable, useTable, BasicColumn, FormSchema, useRender } from "@/components/Table";
import { useTranslation } from "react-i18next";
import Toolbar from "@/components/ViewComponents/Toolbar";
import { patientOrdersPage } from "@/api/MedicalExamination/index";

const index = () => {
	const { t } = useTranslation();
	const searchFormSchema: FormSchema[] = [
		{
			label: t("felix_ui.cli_name"),
			field: "username",
			component: "Input"
		},
		{
			label: t("kevin_ui.date"),
			field: "username",
			component: "DatePicker"
		}
	];
	const columns: BasicColumn[] = [
		{
			title: t("felix_ui.patient_ID"),
			dataIndex: "patientId"
		},
		{
			title: t("felix_ui.serviceFee"),
			dataIndex: "totalPrice"
		},
		{
			title: t("felix_ui.status"),
			dataIndex: "status",
			render: value => useRender.renderDict(value, "order_status")
		}
	];
	const [registerTable] = useTable({
		api: patientOrdersPage,
		columns,
		formConfig: {
			labelWidth: 120,
			schemas: searchFormSchema,
			showActionButtonGroup: true,
			showAdvancedButton: false,
			baseColProps: { span: 6 }
		},
		useSearchForm: true
	});
	return (
		<div className="page">
			<div className="page-content block">
				<BasicTable register={registerTable}></BasicTable>
			</div>
			<Toolbar btnList={[{ key: "print", disabled: true }]} />
		</div>
	);
};
export default index;
